#pragma once
#include <cstdio>
#include <ctime>

#define INF 0
#define DEG 1
#define ERR 2
#define DEFALT_LEVEL DEG

#define LOG(level, format, ...) do{\
    if (DEFALT_LEVEL > level) break;\
    time_t timer = time(NULL);\
    struct tm* lt = localtime(&timer);\
    char buffer[32] = { 0 };\
    strftime(buffer, sizeof buffer - 1, "[%H:%M:%S]", lt);\
    fprintf(stdout, "%s [%s:%d]" format "\n", buffer, __FILE__, __LINE__, ##__VA_ARGS__);\
}while(0)
